﻿using System;


namespace ThePresenter.IO
{
	public class ReadException : ApplicationException
	{
		#region Fields
		/// <summary>
		/// Reader.
		/// </summary>
		readonly IReader _Reader;
		#endregion


		#region Properties
		/// <summary>
		/// Gets the reader.
		/// </summary>
		/// <value>The reader.</value>
		public IReader Reader
		{
			get
			{
				return _Reader;
			}
		}
		#endregion


		#region Constructors
		/// <summary>
		/// Initializes a new instance of the <see cref="ReadException"/> class.
		/// </summary>
		public ReadException()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="ReadException"/> class.
		/// </summary>
		/// <param name="message">A message that describes the error.</param>
		public ReadException(string message)
			: base(message)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="ReadException"/> class.
		/// </summary>
		/// <param name="message">The error message that explains the reason for the exception.</param>
		/// <param name="innerException">
		/// The exception that is the cause of the current exception. If the innerException
		/// parameter is not a null reference, the current exception is raised in a catch
		/// block that handles the inner exception.
		/// </param>
		public ReadException(string message, Exception innerException)
			: base(message, innerException)
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="ReadException"/> class.
		/// </summary>
		/// <param name="message">The error message that explains the reason for the exception.</param>
		/// <param name="innerException">
		/// The exception that is the cause of the current exception. If the innerException
		/// parameter is not a null reference, the current exception is raised in a catch
		/// block that handles the inner exception.
		/// </param>
		/// <param name="reader">Instance of the <see cref="ThePresenter.IO.IReader"/>.</param>
		public ReadException(string message, Exception innerException, IReader reader)
			: this(message, innerException)
		{
			_Reader = reader;
		}
		#endregion
	}
}
